/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package VIMS;
import java.sql.*;
import java.util.Vector;

/**
 *
 * @author shyan
 */
public class ExtractInfo {
    
    String host="jdbc:mysql://localhost:3306/vims";
    String username="root";
    String password="123";
    String UserID=null;
    String UserPW=null;
    String Type=null;
    
  
    
    ExtractInfo(String call)
    {
        Type=call;
    }
    
    public Object[] GetEmpInfo()
    {
        Connection con=null;
        Object[] DataArray= new Object[16];
            try
            {
                // load mysql driver
                Class.forName("com.mysql.jdbc.Driver");
                con = DriverManager.getConnection(host, username, password);
                
                Statement stmt = con.createStatement();
                String Query = "SELECT * FROM employee WHERE EMP_USERNAME ='"+Type+"'";
                ResultSet rset = stmt.executeQuery(Query);
                
                ResultSetMetaData md = rset.getMetaData();
                int columnCount = md.getColumnCount();
                if(rset.next())
                {
                    for(int i=1; i<=columnCount ; i++)
                        DataArray[i-1]=rset.getString(i);
                }              
              
                
                                   
            }
            catch (SQLException e)
            {
                System.out.println("SQL Exception: "+ e.toString());
            }
            catch (ClassNotFoundException cE)
            {
                System.out.println("Class Not Found Exception: "+ cE.toString());
            }
             return DataArray;
    }
    
}